import QtQuick 2.6
import QtQuick.Layouts 1.1

import "../../../Base/UiBase"
import "../../../Base/Config"

Rectangle {
    width: parent.width
    height: 180 * Size.ratio
    color: index % 2 === 0 ? Color.foregroundDarker : Color.foreground
    RowLayout {
        anchors.fill: parent
        Item {
            Layout.preferredWidth: height
            Layout.fillHeight: true
            HeadHolder {
                anchors.centerIn: parent
                SvgzImage {
                    width: 120 * Size.ratio
                    height: 120 * Size.ratio
                    source: model.head
                }
            }
        }
        Item {
            Layout.topMargin: 10 * Size.ratio
            Layout.rightMargin: 20 * Size.ratio
            Layout.bottomMargin: 10 * Size.ratio
            Layout.fillWidth: true
            Layout.fillHeight: true
            ColumnLayout {
                spacing: Size.elementInterval
                anchors.fill: parent
                Text {
                    text: model.name
                    font.pixelSize: Size.normalFont
                }
                Row {
                    Text {
                        text: model.unit
                        font.pixelSize: Size.smallFont
                    }
                    Item {
                        width: 30 * Size.ratio
                        height: parent.height
                    }
                    Text {
                        text: model.level
                        font.pixelSize: Size.smallFont
                    }
                }
                Row {
                    Text {
                        text: qsTr("毕业于") + model.school
                        font.pixelSize: Size.smallFont
                    }
                    Item {
                        width: Size.elementInterval
                        height: parent.height
                    }
                    Text {
                        text: model.level
                        font.pixelSize: Size.smallFont
                    }
                }
                Text {
                    Layout.fillWidth: true
                    Layout.fillHeight: true
                    clip: true
                    text: model.detail
                    font.pixelSize: Size.smallFont
                    color: Color.virtualInput
                    wrapMode: Text.WrapAnywhere
                }
                Row {
                    Layout.alignment: Qt.AlignRight
                    Text {
                        text: qsTr("已评：") + model.evaluated
                        font.pixelSize: Size.smallFont
                        color: Color.virtualInput
                    }
                    Item {
                        width: 30 * Size.ratio
                        height: parent.height
                    }
                    Text {
                        text: qsTr("好评率：") + (model.acceptedEvaluation
                                        / model.evaluated * 100).toFixed(
                                  0) + "%"
                        font.pixelSize: Size.smallFont
                        color: Color.virtualInput
                    }
                }
            }
        }
    }

    BottomDivider {
    }
}
